package com.swancloud.model.compute.ext;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.swancloud.model.ModelEntity;

/**
 * A model class which enables an administrative user to fetch in-progress migrations for a region or specified cell in a region
 *
 * @author Jeremy Unruh
 */
public interface Migration extends ModelEntity {

    public enum Status {
        MIGRATING,
        ERROR,
        DONE;

        @JsonCreator
        public static Status forValue(String value) {
            if (value != null)
            {
                for (Status s : Status.values()) {
                    if (s.name().equalsIgnoreCase(value))
                        return s;
                }
            }
            return Status.MIGRATING;
        }
    }

    /**
     * @return the migration ID
     */
    String getId();

    /**
     * @return the ID of the instance being migrated
     */
    String getInstanceUuid();

    /**
     * @return the migration status
     */
    Status getStatus();

    /**
     * @return the created timestamp
     */
    Date getCreatedAt();

    /**
     * @return the last updated timestamp
     */
    Date getUpdatedAt();

    /**
     * @return the destination compute node
     */
    String getDestCompute();

    /**
     * @return the destination host
     */
    String getDestHost();

    /**
     * @return the destination node
     */
    String getDestNode();

    /**
     * @return the source compute node
     */
    String getSourceCompute();

    /**
     * @return the source node
     */
    String getSourceNode();

    /**
     * @return the ID of the new instance type
     */
    String getNewInstanceTypeId();

    /**
     * @return the ID of the old instance type
     */
    String getOldInstanceTypeId();

    /**
     * @return The amount of disk, in bytes, that has been processed during the migration.
     */
    Integer getDiskProcessed();
    /**
     * @return The amount of disk, in bytes, that still needs to be migrated.
     */
    Integer getDiskRemaining();
    /**
     * @return The total amount of disk, in bytes, that needs to be migrated.
     */
    Integer getDiskTotal();
    /**
     * The amount of memory, in bytes, that has been processed during the migration.
     */
    Integer getMemoryProcessed();
    /**
     * The amount of memory, in bytes, that still needs to be migrated.
     */
    Integer getMemoryRemaining();
    /**
     * The total amount of memory, in bytes, that needs to be migrated.
     */
    Integer getMemoryTotal();
    /**
     * @return The UUID of the server.
     */
    String getServerUUID();
    /**
     * The UUID of the migration.
     *
     * New in version 2.59
     */
    String getUUID();
    /**
     * The ID of the user which initiated the server migration. The value may be null for older migration records.
     *
     * New in version 2.80
     */
    String getUserId();
    /**
     * The ID of the project which initiated the server migration. The value may be null for older migration records.
     *
     * New in version 2.80
     */
    String getProjectId();
}

